#include "StdAfx.h"
#include "OneDdsCltThread.h"
#include "DdfFile.h"
#include "../DDSFile/DDsFrameFactory.h"
#include "../ddsfile/DDsFileHeaderFactory.h"
#include "MainFrm.h"

COneDdsCltThread::COneDdsCltThread(void)
{

	m_dwTickCountPre = 0;
	m_dwTickCountCur = 20;
	m_nRecvFrameSum = 100;
	m_nType = 1;

}

COneDdsCltThread::~COneDdsCltThread(void)
{
	
}
void	COneDdsCltThread::OnDataRecv( int nType, unsigned char * buf, int nsize )
{

	if( nType == 4 )//for test header
	{		
		memcpy( (char*)&m_CurHeader, buf, nsize );
	}
	else if(  nType == 1 )//HF
	{
		memcpy( (char*)&m_CurFrame, buf, nsize );		
		CMainFrame* pfrm = (CMainFrame*)::AfxGetMainWnd();
		pfrm->NewFrameComing( m_CurFrame );
			
	}
	else if( nType == 3 ) //netinfo
	{
		memcpy( (char*)&m_sysParam, buf, nsize );
		CMainFrame* pfrm = (CMainFrame*)::AfxGetMainWnd();
		if( pfrm != NULL )
		{
			pfrm->GetSonarIniFile()->FromParamStruct( m_sysParam );
		}		
	}
	else if( nType == 2 ) //lf
	{
		memcpy( (char*)&m_CurFrame, buf, nsize );
		CMainFrame* pfrm = (CMainFrame*)::AfxGetMainWnd();
		pfrm->NewFrameComing( m_CurFrame );
	}


}